package com.example.ecommercedemo.service;

public class ApiResult {
    private Integer code;
    private String message;
    private Object data;
    private ApiResult(Integer code, String message, Object data) {
        super();
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static ApiResult success(Object data) {
        return new ApiResult(200, "操作成功", data);
    }

    public static ApiResult error() {
        return new ApiResult(500, "操作失败", "");
    }

    public static ApiResult error(String message) {
        return new ApiResult(500, message, "");
    }
    public static ApiResult error(Integer code,String message) {
        return new ApiResult(code, message, "");
    }
    //添加get/set⽅法
}
